var http = require('http')
var url = require('url')

var server = http.createServer((req, res) => {
  var pathname = url.parse(req.url).pathname
  if (pathname === '/') {
    res.end('it is main')
  }
  if (pathname === '/test1') {
    res.end('it is test1')
  }
  if (pathname === '/test2') {
    res.end('it is test2')
  }
})

server.listen(8888)
server.on('listening', function () {
  console.log('开启测试服务')
})